package com.naicheng.ivote.views;

import java.util.HashMap;

import org.json.JSONObject;

import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.naicheng.ivote.R;
import com.naicheng.ivote.doman.AboutusBean;
import com.naicheng.ivote.doman.BaseResponseEntity;
import com.naicheng.ivote.engin.BaseActivity;
import com.naicheng.ivote.parser.BaseParser;
import com.naicheng.ivote.uiself.ToastUtils;
import com.naicheng.ivote.utils.AppManager;
import com.naicheng.ivote.utils.MyPreferences;
import com.naicheng.ivote.volley.Response.Listener;

public class AboutUsActivity extends BaseActivity {
	
	AboutUsActivity CTAUA=AboutUsActivity.this;
	private MyPreferences preference;
	AppManager appManager = AppManager.getAppManager();
	
	private TextView myset_about_back_but;
	private TextView myset_about_main_tv;
	
	private HashMap<String, String> map;
	
	private AboutusBean textBean;
	
	@Override
	protected void setConentView() {
		setContentView(R.layout.activity_myset_about);
	}
	@Override
	protected void init() {
		
		preference=MyPreferences.getPrefer(CTAUA, "myconfig");
		map=new HashMap<String, String>();
		textBean=new AboutusBean();
		
		myset_about_back_but=(TextView) findViewById(R.id.myset_about_back_but);
		myset_about_main_tv=(TextView) findViewById(R.id.myset_about_main_tv);
		
		
	}
	@Override
	protected void processLogic() {
		
		map=new HashMap<String, String>();
		
		super.getDataFromServer("about", map, new Listener<JSONObject>() {
			@Override
			public void onResponse(JSONObject response) {
				System.out.println("response--------->"+response.toString());
				BaseResponseEntity<AboutusBean> mResponse = new BaseParser<AboutusBean>().parserDomain(response, AboutusBean.class);
				if (mResponse != null && mResponse.getState()) {
					textBean=mResponse.getSingleDomain();
					if(null!=textBean){
						myset_about_main_tv.setText(textBean.getText());
					}else{
						ToastUtils.getCenterDownToast(CTAUA, "获取数据异常！");
					}
					
				}else{
					ToastUtils.getCenterDownToast(CTAUA, mResponse.getMsg());
				}
			}
			
		}, CTAUA);
		
	}
	@Override
	protected void setOnClickListener() {
		
		myset_about_back_but.setOnClickListener(CTAUA);
		myset_about_main_tv.setOnClickListener(CTAUA);
		
	}
	@Override
	public void onClick(View v) {
		
		switch (v.getId()) {
		case R.id.myset_about_back_but:
			appManager.finishActivity();
			break;
		case R.id.myset_about_main_tv:
			
			break;
		
		}
		
	}

	
	
}
